From 28d92ab92e4f70afd59b0a90ccb6564313d9b802 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 25 May 2005 12:44:27 +0000 Subject: [PATCH] bitkeeper revision 1.1550 (4294732bb-16oL8fVDfFOUaEjoM4oA) Fix the 64-bit build. Signed-off-by: Keir Fraser --- xen/include/asm-x86/div64.h | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/xen/include/asm-x86/div64.h b/xen/include/asm-x86/div64.h index 28ed8b296a..b43f1ab486 100644 --- a/xen/include/asm-x86/div64.h +++ b/xen/include/asm-x86/div64.h @@ -1,6 +1,20 @@ #ifndef __I386_DIV64 #define __I386_DIV64 +#include + +#if BITS_PER_LONG == 64 + +# define do_div(n,base) ({ \ + uint32_t __base = (base); \ + uint32_t __rem; \ + __rem = ((uint64_t)(n)) % __base; \ + (n) = ((uint64_t)(n)) / __base; \ + __rem; \ + }) + +#else + /* * do_div() is NOT a C function. It wants to return * two values (the quotient and the remainder), but @@ -27,22 +41,6 @@ __mod; \ }) -/* - * (long)X = ((long long)divs) / (long)div - * (long)rem = ((long long)divs) % (long)div - * - * Warning, this will do an exception if X overflows. - */ -#define div_long_long_rem(a,b,c) div_ll_X_l_rem(a,b,c) - -extern inline long -div_ll_X_l_rem(long long divs, long div, long *rem) -{ - long dum2; - __asm__("divl %2":"=a"(dum2), "=d"(*rem) - : "rm"(div), "A"(divs)); - - return dum2; +#endif -} #endif -- 2.30.2